<?php
/**
 * ComProductsSkus.php class file.
 * @author wudg <544038230@qq.com>
 * @date 2020/10/27- 11:01 上午
 */

namespace common\models\com;

use common\models\base\ActiveRecord;
use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class for table "com_products_skus".
 *
 * @property string $skuId skuID
 * @property int $stock 库存信息
 * @property int $price 价格信息，单位分
 * @property string $properties 属性Key.序列化存储
 * @property string $sku_code sku 编码
 * @property string $cover sku 图片
 * @property string|null $properties_name 属性值，序列化存储
 * @property int $created_at 入库时间
 * @property int $updated_at 更新时间
 */
class ComProductsSkus extends ActiveRecord
{

    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'createdAtAttribute' => 'create_at',
                'updatedAtAttribute' => 'updated_at'
            ]
        ];
    }

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'com_products_skus';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['stock', 'price', 'properties', 'created_at', 'updated_at'], 'required'],
            [['stock', 'price', 'created_at', 'updated_at','uid','mail_id'], 'integer'],
            [['properties_name'], 'string'],
            [['skuId'], 'string', 'max' => 50],
            [['sku_code'], 'string', 'max' => 100],
            [['cover'], 'string', 'max' => 255],
            [['properties'], 'string', 'max' => 500],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'skuId' => 'skuID',
            'stock' => '库存信息',
            'price' => '价格信息，单位分',
            'sku_code' => 'SKU 编码',
            'cover' => 'SKU 图片',
            'properties' => '属性Key.序列化存储',
            'properties_name' => '属性值，序列化存储',
            'created_at' => '入库时间',
            'updated_at' => '更新时间',
        ];
    }
}
